home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000094_icon-group-sender _Sun Mar 23 07:14:34 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:40:39 MST
  2. Date: Sun, 23 Mar 1997 07:14:34 -0600 (CST)
  3. From: "Chris D. Tenaglia" <cdt@post.its.mcw.edu>
  4. To: Stuart Robinson <Stuart.Robinson@anu.edu.au>
  5. Cc: icon-group@cs.arizona.edu
  6. Subject: Re: Problem with Program
  7. In-Reply-To: <33338AEF.420@anu.edu.au>
  8. Message-Id: <Pine.ULT.3.90.970323070458.2675A-100000@post.its.mcw.edu>
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13. Content-Length: 1427
  14.  
  15. I assume that code snippit was pseudocode? If not, there is
  16. also the need to put multiple expressions of a clause between
  17. curly braces {
  18.              presentline := "quote"
  19.              write( "\t" || line );
  20.              }
  21.  
  22. String scanning has it uses, but it makes the problem harder in
  23. this case. There are many ways to skin this cat.
  24.  
  25. procedure main()
  26.   while line := read() do
  27.     {
  28.     line := if find("{Q",line) then "\t" || line || "\n\t" else line
  29.     writes(line)
  30.     }
  31.   end
  32.  
  33. Chris Tenaglia   (system manager)     |  cdt@post.its.mcw.edu
  34. Medical College of Wisconsin          |
  35. 8701 W. Watertown Plank Rd.           |  Ce que vous voyez est
  36. Milwaukee, WI 53226   (414)456-8765   |  ce que vous obtenez !
  37.  
  38. On Sat, 22 Mar 1997, Stuart Robinson wrote:
  39.  
  40. > This short little program is meant to read a line and write either (1) 
  41. > a tab followed by the line or (2) simply the line.  It should do (1) 
  42. > if the line either contains "{Q" or follows a line with "{Q"; 
  43. > otherwise, it should do (2).
  44. > procedure main()
  45. > lastline := ""
  46. > while line := read() do
  47. >     {
  48. >     line ?
  49. >         {
  50. >         if find( "{Q" ) 
  51. >             then 
  52. >                 presentline := "quote"
  53. >                 write( "\t" || line );
  54. >         else 
  55. >             if lastline == "quote" 
  56. >                 then 
  57. >                     write( "\t" || line )
  58. >                     presentline := "notquote";
  59. >         else other 
  60. >             write( line )
  61. >             presentline := "notquote"
  62. >         }
  63. >     }
  64. > lastline := presentline
  65. > end
  66.